<template> <!-- 发货记录-->
	<view class="wrap">
		<js-error mode="bottom" ref="jsError"></js-error>
		<view class="cu-bar bg-white ">
			<view class="action">
				<u-icon name="/static/common/img/invcode.png" size="80"></u-icon>
				<text class="cuIcon-titles text-green text-bold">货位信息</text> 
			</view>
			<view class="" @click="toAddDetail" style="position: relative;">
				<u-icon name="/static/common/img/addPlan.png" size="80" class="addPlan" v-if="cstatus!='已推送'"></u-icon>
			</view>
		</view>
		<scroll-view class="scroll-list" scroll-y="true">
			<u-swipe-action v-for="(item, index) in list" :key="item.id" :index="index">
					<u-collapse-item :open="true" :disabled="true">
						<view class="" style="width: 100%;" slot="title">
							<view class="text text-red" style="position: relative;"><text class="text-bold"><text class="text-red">{{index+1}}、</text>确认发货重量：{{item.qrWeight}}</text>
								<u-icon name="/static/common/img/edit.png" @click="editDetail(item)"class="upload" style="" size="30" v-if="cstatus!='已推送'"></u-icon>
								<u-icon name="/static/common/img/delData.png" @click="delData(item.id)" class="rights" style="" size="30" v-if="cstatus!='已推送'"></u-icon>
							</view><br/>
							<!-- <view class="text padding-left-lg"><text class="text-bold">确认发货重量：</text>{{item.qrWeight}}</view><br/> -->
							<view class="text padding-left-lg"><text class="">发货批次：</text>{{item.ibatch}}</view><br/>
							<view class="text padding-left-lg"><text class="">发货货位：</text>{{item.cposition}}</view><br/>
						</view>
						<view style="border-bottom: 2px solid #000000;"></view>
					</u-collapse-item>
			</u-swipe-action>
		</scroll-view>
		<!-- <view class="btn-plus" @click="navTo('form')">
			<u-icon name="plus-circle-fill" size="90" color="#3d87ff"></u-icon>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				address: [],
				provinceList: [],
				cityAllList: [],
				addressIndex: [0, 0],
				keywords:'',
				query: {
					status: '',
					pageNo: 1,
					pageSize: 20,
					dlid:{},
				},
				model:{
					id:'',
				},
				list:[],
				hid:'',
				cstatus:'',
				loadStatus: 'loadmore',
				show: false,
				type:'text',
				startTime: false,//控制日期显示
				endTime: false,//控制日期显示
			}
		},
		onLoad(params){
			console.log(params)
			this.hid = params.hid
			this.cstatus = params.cstatus
			this.loadList();
			uni.$on('refreshData',() => {
				this.loadList();
			})
		},
		methods: {
			toAddDetail(){
				const that=this
				uni.navigateTo({
				  url: '/pages/mf/fh/fhHwAdd?hid='+that.hid,
				  events: {
				    // 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
				    Filter(data) {
						
				    }
				  },
				  success: function(res) {
				    // 通过eventChannel向被打开页面传送数据
				    // res.eventChannel.emit('initfilter', that.filter)
				  }
				})
			},
			delData(id){
				this.model.id = id;
				var data = {
					mfCarplanFhB: JSON.stringify(this.model),
					useStatus: 1
				};
				this.$u.api.mffh.delBDetail(data).then(res => {
					if(res.result == 'true'){
						this.$u.toast(res.message);
						this.loadList();
					}else{
						this.$refs.jsError.showError('',res.message,'error');
					}
					
				});
			},
			editDetail(model){
				const that=this
				uni.navigateTo({
				  url: '/pages/mf/fh/fhHwEdit?model='+JSON.stringify(model),
				  events: {
				    // 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
				    Filter(data) {
						
				    }
				  },
				  success: function(res) {
				    // 通过eventChannel向被打开页面传送数据
				    // res.eventChannel.emit('initfilter', that.filter)
				  }
				})
			},
			loadMore() {
				this.loadStatus = "loading";
				setTimeout(() => {
					this.query.pageNo += 1;
					this.loadList("add");
				}, 100);
			},
			loadList(type) {
				if(this.hid != null ||this.hid!='' ){
					this.list = [];
					var data = {
						id: this.hid,
						useStatus: 1
					};
					this.$u.api.mffh.fhDetailList(data).then(res => {
						
						var list = res.mfCarplanFhC;
						// this.list = list.mfCarplanFhBList;
						var data = list.mfCarplanFhBList;
						if(type=="add"){
							for(var i=0;i<data.length;i++){
								this.list.push(data[i])
							}
						}else{
							this.list=data;	
						}
					})
				}else{
					
				}
				
			},
			optionsClick(rowIndex, btnIndex) {
				let row = this.list[rowIndex];
				if(btnIndex == 0) {
					bpmUtils.navTrace(this, 'formKey=leave&bizKey=' + row.id);
				}
			},
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
		}
	}
</script>

<style>
.tableclass{
	border-left: 1px solid rgb(228, 231, 237);
	border-top: 1px solid rgb(228, 231, 237);
	background-color: rgb(255, 255, 255);
	width: 100%;box-sizing: border-box;
}
.thclass {
	text-align: center;
	padding: 5px 3px;
	border-bottom: 1px solid rgb(228, 231, 237);
	border-right: 1px solid rgb(228, 231, 237);
	flex-direction: column;
	flex: 1;
	justify-content: center;
	font-size: 14px;
	color: #303133;
	font-weight: bold;
	background-color: #f5f6f8;
}
.trclass {
	height: 52px;
}
.tdclass {
	padding: 5px 3px;
	border-bottom: 1px solid rgb(228, 231, 237);
	border-right: 1px solid rgb(228, 231, 237);
	flex-direction: column;
	flex: 1;
	justify-content: center;
	font-size: 14px;
	color: #505256;
	align-self: stretch;
	box-sizing: border-box;
	height: 100%;
}
.box .item{
	margin: 0 0px 0px;
}
.tui-line-cell {
		width: 100%;
		box-sizing: border-box;
		display: flex;
		align-items: center;
	}
	.tui-title {
		line-height: 32rpx;
		min-width: 120rpx;
		flex-shrink: 0;
	}
	
	.tui-input {
		font-size: 32rpx;
		color: #333;
		padding-left: 20rpx;
		flex: 1;
		overflow: visible;
	}
.footer {
	position: fixed;
	left: 0;
	bottom: 20px;
	width: 100%;
	
}
.floatright {
  position: fixed;
  bottom: 12px;
  right:12px;
  width: 25%;
  line-height: var(--footer-height);
  background: #ffffff;
  color: #ffffff;
}
.add{
	position: absolute;
	right: 130rpx;
	top: 0;
	margin-right: 0;
}
.upload {
	position: absolute;
	right: 65rpx;
	top: 0;
	margin-right: 0;
}
.rights {
	position: absolute;
	/* display: inline-block; */
	right: 0;
	top: 0;
	margin-right: 0;
	/* width: 100%; */
	
}
.addPlan{
	position: absolute;
	right: 60rpx;
	top: -40rpx;
}
</style>
